package main

import (
	"fmt"
	time2 "time"
)

func main() {
	/*timeObj := time.Now()
		fmt.Println(timeObj)
		fmt.Println(timeObj.Day())
		fmt.Println(timeObj.Month())
		fmt.Println(timeObj.Year())
		//获取当前日期
		currentDate := timeObj.Format("2006-01-02 03:04:05")
		currentDates := timeObj.Format("2006-01-02 15:04:05")
		fmt.Println(currentDate)
		fmt.Println(currentDates)
	//	获取当前时间戳
		unixTime := timeObj.Unix()
		fmt.Println(unixTime)
		unixNaTime := timeObj.UnixNano()
		fmt.Println(unixNaTime)

	//	把时间戳->日期对象
		strtotime := time.Unix(int64(unixTime),0)
		fmt.Println(strtotime)
		str := strtotime.Format("2006-01-02 15:04:05")
		fmt.Println(str)*/

	//获取当前时间戳
	var time = time2.Now()
	fmt.Println(time.Unix())
	//获取到当前日期
	fmt.Println(time.Format("2006-01-02 15:04:05"))

}
